#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

#endregion

namespace Weazel.Gezel.Parser
{
  /// <summary>
  /// The ParseException is thrown whenever a gezel description
  /// is not valid and thus cannot be parsed. The Position field
  /// records the line and column position of the tokenizer at the
  /// time the error was discovered (which may not be where the 
  /// real error was).
  /// </summary>
  public class ParseException : ApplicationException
  {
    /// <summary>
    /// Records the position at which the parse
    /// exception occured.
    /// </summary>
    public readonly Gezel.Model.Position Position;


    /// <summary>
    /// Constructs the ParseException with the specified message.
    /// </summary>
    /// <param name="message">the error message</param>
    public ParseException(string message) : base(message)
    {
    }

    /// <summary>
    /// Constructs the ParseException with the specified message
    /// and position at which the error occured.
    /// </summary>
    /// <param name="message">the error message</param>
    /// <param name="pos">the position</param>
    public ParseException(string message, Gezel.Model.Position pos) : base(message + "at line " + pos.LineNumber)
    {
      this.Position = pos;
    }
  }
}